/**
 * 
 */
package edu.w106.platform.server;

import java.io.File;

/**
 * @author w106
 * 
 */
public class WarObj {
	private String warAbsPath;
	private String context;

	public WarObj(String warName) {
		File f = new File(warName);
		warAbsPath = f.getAbsolutePath();
		String name = f.getName();
		if ("root.war".equalsIgnoreCase(name)) {
			context = "/";
		} else {
			context = "/" + name.substring(0, name.length() - 4);
		}
	}

	public String toString() {
		return String.format("context=%s,absPath:%s", context, warAbsPath);
	}

	/**
	 * @return the warAbsPath
	 */
	public String getWarAbsPath() {
		return warAbsPath;
	}

	/**
	 * @param warAbsPath
	 *            the warAbsPath to set
	 */
	public void setWarAbsPath(String warAbsPath) {
		this.warAbsPath = warAbsPath;
	}

	/**
	 * @return the context
	 */
	public String getContext() {
		return context;
	}

	/**
	 * @param context
	 *            the context to set
	 */
	public void setContext(String context) {
		this.context = context;
	}

}
